package com.tbit.manager.api;

import com.tbit.manager.api.dto.CouponUserDTO;
import com.tbit.manager.api.dto.PackageDelayDTO;
import com.tbit.manager.enums.ApiConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;


/**
 * 优惠卷
 *
 * @author ：zhangtianyou
 * @since 2024/11/22
 */
@FeignClient(name = ApiConstants.NAME)
public interface CouponApi {

    String PREFIX = ApiConstants.PREFIX + "/coupon";

    /**
     * 查询用户优惠券
     *
     * @param userId    用户ID
     * @param accountId 区域id
     * @param pageSize  条数
     * @param pageNum   页码
     * @return List<CouponUserDTO>
     */
    @GetMapping(PREFIX + "/userCouponPage")
    List<CouponUserDTO> getByUserIdPage(@RequestParam("userId") Integer userId,
                                        @RequestParam("accountId") Integer accountId,
                                        @RequestParam("pageSize") Integer pageSize,
                                        @RequestParam("pageNum") Integer pageNum);

    /**
     * 获取代理商所有可以优惠券
     *
     * @param accountId 区域id
     * @return List<CouponUserDTO>
     */
    @GetMapping(PREFIX + "/getCouponIsVail")
    List<CouponUserDTO> getCouponIsVail(@RequestParam("accountId") Integer accountId);

    /**
     * 批量赠送用户优惠券
     *
     * @param couponUserDTO
     */
    @PostMapping(value = PREFIX + "/addBatch", consumes = "application/json")
    void addBatch(@RequestBody CouponUserDTO couponUserDTO);

    /**
     * 延长优惠券到期时间
     *
     * @param delayDTO .
     * @return .
     */
    @PostMapping(value = PREFIX + "/modifyExpireTime", consumes = "application/json")
    void modifyExpireTime(@RequestBody PackageDelayDTO delayDTO);

    /**
     * 根据用户id和用户优惠券id置为失效
     *
     * @param couponUserId 根据用户优惠券id置为失效
     * @param userId       根据用户将优惠券全部置为失效
     */
    @GetMapping(PREFIX + "/userCouponEdit")
    void userCouponEdit(@RequestParam(value = "couponUserId", required = false) Integer couponUserId,
                        @RequestParam(value = "userId", required = false) Integer userId);
}
